init{
  emailServer=SimpleSmtpServer.start(Integer.valueOf(EMAIL_SMTP_PORT));
}
destroy{
  if (emailServer != null) {
    emailServer.stop();
  QueueService service=new QueueServiceResolver().resolveQueue(SQS_SERVER,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY);
  MessageQueue msgQueue=service.getOrCreateMessageQueue(TASK_SQS_QUEUE);
  Message msg;
  while ((msg=msgQueue.receiveMessage()) != null) {
}
testEmailDelivery{
  sendEmail();
  assertThat(emailServer.getReceivedEmailSize()).isEqualTo(1);
  SmtpMessage email=getEmail();
  assertThat(email.getBody()).contains(message);
  assertThat(email.getHeaderValue("To")).isEqualTo(to);
  assertThat(email.getHeaderValue("From")).isEqualTo(EMAIL_FROM);
  assertThat(email.getHeaderValue("Content-Type")).contains("UTF-8");
}
sendEmail{
  D.withDependencies(new SendEmailTaskExecutor(),mock(BoundRequestContext.class),new Callable<Void>(){
      for (int i=0; i < REDELIVERY_LIMIT; i++) {
        Thread.sleep(7000);
        taskTimerBean.timeout(null);
        if (emailServer.getReceivedEmailSize() > 0) {
}
call{
    Thread.sleep(7000);
    taskTimerBean.timeout(null);
    if (emailServer.getReceivedEmailSize() > 0) {
  return null;
}
getEmail{
  Iterator inbox=emailServer.getReceivedEmail();
  SmtpMessage email=(SmtpMessage)inbox.next();
  return email;
}
